<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>美食分享平台</title>
    <link th:href="@{/webjars/bootstrap/4.0.0/css/bootstrap.css}" rel="stylesheet">
    <link th:href="@{/asserts/css/FoodShare.css}" rel="stylesheet">
</head>
<body>
<!--引入抽取的topbar-->
<div th:replace="common/topbar::topbar"></div>

<div class="container-fluid">
    <div class="row">
        <!--引入侧边栏-->
        <div th:replace="common/sidebar::sidebar(active='user')"></div>
        <main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
            <form action="/foodshare/user/saveUser" method="post">
                <input type="hidden" name="userId" th:value="${user.userId}">
                <div class="form-row">
                    <div class="form-group col-md-6">
                        <label>用户名</label>
                        <input type="text" class="form-control" name="username" th:value="${user.username}">
                    </div>
                    <div class="form-group col-md-6">
                        <label>密码</label>
                        <input type="text" class="form-control" name="password" th:value="${user.password}">
                    </div>
                </div>
                <div class="form-row">
                    <div class="form-group col-md-6">
                        <label>性别</label>
                        <select name="sex" class="form-control">
                            <option th:selected="${user.sex eq '男'}">男</option>
                            <option th:selected="${user.sex eq '女'} ">女</option>
                        </select>
                    </div>
                    <div class="form-group col-md-6">
                        <label>权限</label>
                        <select name="role" class="form-control">
                            <option th:selected="${user.role eq 1}">1</option>
                            <option th:selected="${user.role eq 0}">0</option>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label>邮箱号</label>
                    <input type="email" class="form-control" name="email" placeholder="name@example.com" th:value="${user.email}">
                </div>
                <div class="form-row">
                    <div class="form-group col-md-6">
                        <label>手机号码</label>
                        <input type="text" class="form-control" name="phone" th:value="${user.phone}">
                    </div>
                    <div class="form-group col-md-4">
                        <label>安全问题</label>
                        <select name="question" class="form-control" th:value="${user.question}">
                            <option th:selected="${user.question eq '你的出生地在哪？'}">你的出生地在哪？</option>
                            <option th:selected="${user.question eq '你印象最深的动漫名字？'}">你印象最深的动漫名字？</option>
                            <option th:selected="${user.question eq '你最熟悉的名字？'}">你最熟悉的名字？</option>
                            <option th:selected="${user.question eq '你最喜欢的水果？'}">你最喜欢的水果？</option>
                        </select>
                    </div>
                    <div class="form-group col-md-2">
                        <label>安全答案</label>
                        <input type="text" class="form-control" name="answer" th:value="${user.answer}">
                    </div>
                </div>
                <button type="submit" class="btn btn-primary">修改</button>
            </form>
        </main>
    </div>
</div>
</body>
</html>